<?php

use support\Request;
use Webman\Route;

Route::group('/', function () {
    //公告
    Route::group('index', function () {
        Route::any('/inform-types', [\App\controller\IndexController::class, 'informTypes']);
        Route::any('/inform', [\App\controller\IndexController::class, 'inform']);
    })->middleware([
        app\middleware\CheckSign::class,
    ]);

    //用户
    Route::group('user', function () {
        Route::any('/login', [\App\controller\UserController::class, 'login']);
        // Route::any('/login-role', [\App\controller\UserController::class, 'loginRole']);
        // Route::any('/update-role-info', [\App\controller\UserController::class, 'updateRoleInfo']);
        // Route::any('/red-dot', [\App\controller\UserController::class, 'redDot']);
        // Route::any('/record-item', [\App\controller\UserController::class, 'recordItem']);
        // Route::any('/exchange-log', [\App\controller\UserController::class, 'exchangeLog']);
        // Route::any('/exchange-num', [\App\controller\UserController::class, 'exchangeNum']);
        // Route::any('/check-kick', [\App\controller\UserController::class, 'checkKick']);
        // Route::any('/reset-clear', [\App\controller\UserController::class, 'resetClear']);
        // Route::any('/set-vip', [\App\controller\UserController::class, 'setVip']);
    })->middleware([
        app\middleware\CheckSign::class,
    ]);

    // //公会
    // Route::group('guild', function () {
    //     Route::any('/create-guild', [\App\controller\GuildController::class, 'createGuild']);
    //     Route::any('/guild-list', [\App\controller\GuildController::class, 'guildList']);
    //     Route::any('/guild-info', [\App\controller\GuildController::class, 'guildInfo']);
    //     Route::any('/update-notice', [\App\controller\GuildController::class, 'updateNotice']);
    //     Route::any('/mem-list', [\App\controller\GuildController::class, 'memList']);
    //     Route::any('/invite-join', [\App\controller\GuildController::class, 'inviteJoin']);
    //     Route::any('/do-join', [\App\controller\GuildController::class, 'doJoin']);
    //     Route::any('/exit', [\App\controller\GuildController::class, 'exit']);
    //     Route::any('/set-position', [\App\controller\GuildController::class, 'setPosition']);
    //     Route::any('/level-up', [\App\controller\GuildController::class, 'levelUp']);
    //     Route::any('/complete-task', [\App\controller\GuildController::class, 'completeTask']);
    //     Route::any('/kick-out', [\App\controller\GuildController::class, 'kickOut']);
    //     Route::any('/update-designation', [\App\controller\GuildController::class, 'updateDesignation']);
    //     Route::any('/appoint-president', [\App\controller\GuildController::class, 'appointPresident']);
    //     Route::any('/do-level-up-tech', [\App\controller\GuildController::class, 'doLevelUpTech']);
    //     Route::any('/shop-buy', [\App\controller\GuildController::class, 'shopBuy']);
    // })->middleware([
    //     app\middleware\CheckSign::class,
    // ]);

    //交易行
    Route::group('trade', function () {
        Route::any('/put-on', [\App\controller\TradeController::class, 'putOn']);
        Route::any('/item-list', [\App\controller\TradeController::class, 'itemList']);
        Route::any('/buy', [\App\controller\TradeController::class, 'buy']);
        Route::any('/off-shelf', [\App\controller\TradeController::class, 'offShelf']);
        Route::any('/my-record', [\App\controller\TradeController::class, 'myRecord']);
        Route::any('/log', [\App\controller\TradeController::class, 'log']);
    })->middleware([
        app\middleware\CheckSign::class,
        app\middleware\CheckBan::class,
    ]);

    //邮件
    Route::group('mail', function () {
        Route::any('/list', [\App\controller\MailController::class, 'list']);
        Route::any('/read', [\App\controller\MailController::class, 'read']);
        Route::any('/batch-receive', [\App\controller\MailController::class, 'batchReceive']);
        Route::any('/del', [\App\controller\MailController::class, 'del']);
        Route::any('/batch-del', [\App\controller\MailController::class, 'batchDel']);
        Route::any('/receive', [\App\controller\MailController::class, 'receive']);
        Route::any('/record-id', [\App\controller\MailController::class, 'recordId']);

    })->middleware([
        app\middleware\CheckSign::class,
    ]);

    //日志
    Route::group('log', function () {
        Route::any('/record', [\App\controller\LogController::class, 'record']);
    })->middleware([
        app\middleware\CheckSign::class,
    ]);

    //排行
    Route::group('rank', function () {
        Route::any('/list', [\App\controller\RankController::class, 'list']);
    })->middleware([
        app\middleware\CheckSign::class,
        app\middleware\CheckBan::class,
    ]);


});

//关闭默认路由
Route::disableDefaultRoute();

Route::fallback(function () {
    return json(['code' => 404, 'msg' => '404 not found']);
});